package com.isoft.game.common.util;

import com.isoft.game.common.constant.DelStatus;
import com.isoft.game.common.constant.FlagStatus;
import com.isoft.game.common.entity.DataEntity;
import com.isoft.game.sys.user.entity.User;

import java.util.Date;

/**
 * Created with family.
 * author: cy
 * Date: 16/6/2
 * Time: 上午9:19
 * description:  用户util
 */
public class UserUtils {
	/**
     * 持久化 当前操作人
     */
    public static void setCurrentPersistOperation(DataEntity entity,User user){
        entity.setCreateBy(user.getBusinessId());
        entity.setCreateDate(new Date());
        entity.setUpdateBy(user.getBusinessId());
        entity.setUpdateDate(new Date());
        entity.setFlag(FlagStatus.NORMAL.getStatus());
        entity.setDelFlag(DelStatus.NORMAL.getStatus());
    }

    /**
     * 持久化 当前修改人
     */
    public static void setCurrentMergeOperation(DataEntity entity,User user){
        entity.setUpdateBy(user.getBusinessId());
        entity.setUpdateDate(new Date());
    }

}
